//using System;
//using System.Text;
//using System.Collections.Generic;
//using System.Linq;
//using Microsoft.Xna.Framework;
//using Microsoft.Xna.Framework.Audio;
//using Microsoft.Xna.Framework.Content;
//using Microsoft.Xna.Framework.GamerServices;
//using Microsoft.Xna.Framework.Graphics;
//using Microsoft.Xna.Framework.Input;
//using Microsoft.Xna.Framework.Media;
//using ebookreader.Resources;

//namespace ebookreader
//{
//    public class ReaderUI : Menu
//    {
//        Reader reader;
//        public ReaderUI(Game game, Reader reader)
//            : base(game, reader.input_manager)
//        {
//            UpdateOrder = (int)ScreenOrder.ReaderUI;
//            DrawOrder = (int)ScreenOrder.ReaderUI;
//            this.reader = reader;
//        }

//        public override void Initialize()
//        {
//            //input_manager = Game.Services.GetService(typeof(IInputManager)) as IInputManager;
//            input_manager.OnTap += new InputManager.Tap(OnTap);
//            sprite_batch = Game.Services.GetService(typeof(SpriteBatch)) as SpriteBatch;
//            disableNotContainedElement = false;
//            base.Initialize();
//        }

//        protected override void LoadContent()
//        {
            
//            Texture2D ui_button_dock = Game.Content.Load<Texture2D>("Textures/UI/ui_dock");
//            SpriteFont ui_font = Game.Content.Load<SpriteFont>("Fonts/small");
//            var ui_search_back = Game.Content.Load<Texture2D>("Textures/UI/search_back");
//            var ui_key = Game.Content.Load<Texture2D>("Textures/UI/key"); 

//            int y = GraphicsDevice.Viewport.Height - ui_button_dock.Height;

//            BoxedLabelButton menu = new BoxedLabelButton(sprite_batch, ui_button_dock,
//                new Vector2(-117, y), ui_font, new Vector2(50,0), Lang.UI_Menu, Color.White, Color.Black);
//            menu.OnPress += new Press((MenuEntry m) => { });

//            BoxedLabelButton bookmark = new BoxedLabelButton(sprite_batch, ui_button_dock,
//                new Vector2(GraphicsDevice.Viewport.Width / 2.0f - ui_button_dock.Width / 2.0f, y),
//                ui_font, Lang.UI_Bookmark, Color.White, Color.Black);
//            bookmark.OnPress += new Press((MenuEntry m) => 
//            {
//                for (int i = 0; i < entries.Count; i++)
//                    entries[i].active = false;
//                reader.input_manager.Active = false;
//                Game.Components.Add(new BookmarkSelPopUp(Game, reader));
//            });

//            BoxedLabelButton page = new BoxedLabelButton(sprite_batch, ui_button_dock,
//                new Vector2(704, y), ui_font, new Vector2(-90,0), s , Color.White, Color.Black);
//            page.OnPress += new Press((MenuEntry m) => {
//                new VirtualKeyboard(
//                        Game, sprite_batch, ui_font,
//                        new TextEdit(sprite_batch, ui_font, ui_search_back, Color.Black, new Vector2(200, 80), "", 400, 60),
//                         ui_key, new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "<-", "OK" }, 10, 10, 70, 200, 5, 5, 2,
//                         (num) =>
//                         {
//                             try
//                             {
//                                 reader.current_page = Math.Max(0, Math.Min(reader.pages.Count-1, (int)Int64.Parse(num)));
//                             }
//                             catch (Exception) { }
//                         }, null);     
           
//            });

//            entries.AddRange(new MenuEntry[] { menu, bookmark, page });

//            base.LoadContent();
//        }
//        StringBuilder s=new StringBuilder();

//        string prova = "/";
//        public override void Update(GameTime gameTime)
//        {
//            s.Remove(0, s.Length);
//            s.Append(reader.current_page + prova + reader.pages.Count);

//            if (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.Back))
//            {
//                reader.currentState.currentBook = null;
//                ScreenManager.SelectMainMenu(Game);
//            }
//            base.Update(gameTime);
//        }
//    }
//}
